import shichen from '@/database/shichen.json'
export function xiaoLiuRenAccurate(lunarMonth, lunarDay, hour) {
  // 验证参数有效性
  // const isValid = (num, min, max) => num >= min && num <= max
  // if (![lunarMonth, lunarDay, hour].every((n) => isValid(n, 1, 12))) {
  //   throw new Error('所有参数应在1-12之间')
  // }

  // 标准算法步骤
  const monthDayIndex = (lunarMonth + lunarDay - 2) % 6
  const finalIndex = (monthDayIndex + hour - 1) % 6
  console.log(finalIndex, (lunarMonth + lunarDay + hour - 3) % 6)
  return finalIndex
}
export function xiaoLiuRenAccurateAll(lunarMonth, lunarDay, hour) {
  return lunarMonth + lunarDay + hour - 2
}
export function shichen2num(str) {
  let value = ''
  for (let i = 0; i < shichen.length; i++) {
    if (str === shichen[i].name) {
      value = shichen[i].value
    }
  }
  return value
}
